home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -serious- / programming / other / tandem / teaching / 59.asm < prev    next >
Assembly Source File  |  1999-09-06  |  3KB  |  99 lines

  1. * 59.asm     TLgetarea and some bevs   version 0.01    8.6.99
  2.  
  3.  
  4.  include 'Front.i'        ;*** replace by 'Tandem.i' to step thru TL's ***
  5.  
  6.  
  7. strings: dc.b 0
  8. st_1: dc.b 'TLgetarea demo + some bevs',0 ;1
  9.  dc.b 'Error: out of chip memory',0 ;2
  10.  dc.b 'Select any region on this window ....',0 ;3
  11.  dc.b ' ',0 ;4
  12.  dc.b '1. Move the mouse pointer to the top left of the region.',0 ;5
  13.  dc.b '2. Press the left mouse button down.',0 ;6
  14.  dc.b '3. Move the mouse pointer to the bottom right of the region.',0 ;7
  15.  dc.b '4. Release the left mouse button.',0 ;8
  16.  dc.b ' ',0 ;9
  17.  dc.b 'The region you select will then be highlighted.',0 ;10
  18.  dc.b '(Alternately, you can press Esc to cancel)',0 ;11
  19.  dc.b 'You chose to cancel',0 ;12
  20.  dc.b 'Chosen region highlighted',0 ;13
  21.  
  22.  ds.w 0
  23.  
  24.  
  25. * test program
  26. Program:
  27.  TLwindow #0,#0,#0,#640,#200,#640,#200,#0,#st_1 ;open window 0
  28.  bne.s Pr_cont             ;go if ok
  29.  TLbad #2                  ;report if can't open window
  30.  rts
  31.  
  32. Pr_cont:
  33.  TLreqbev #20,#100,#70,#20      ;* do some bevs (just for novelty value)
  34.  TLreqbev #120,#100,#70,#20,rec ;bev 2
  35.  TLreqbev #218,#99,#74,#22      ;bev 3
  36.  TLreqbev #220,#100,#70,#20,rec
  37.  TLreqbev #318,#99,#74,#22,rec  ;bev 4
  38.  TLreqbev #320,#100,#70,#20
  39.  TLreqbev #419,#100,#72,#20     ;bev 5
  40.  TLreqbev #420,#100,#70,#20
  41.  TLreqbev #519,#100,#72,#20,rec ;bev 6
  42.  TLreqbev #520,#100,#70,#20,rec
  43.  TLreqbev #80,#135,#70,#20      ;bev 7
  44.  TLreqbev #70,#130,#70,#20
  45.  TLreqarea #72,#131,#66,#18
  46.  TLreqbev #216,#128,#78,#24     ;bev 8
  47.  TLreqbev #220,#130,#70,#20
  48.  TLreqbev #316,#128,#78,#24     ;bev 9
  49.  TLreqbev #320,#130,#70,#20,rec
  50.  TLreqbev #416,#128,#78,#24,rec ;bev 10
  51.  TLreqbev #420,#130,#70,#20,rec
  52.  TLreqbev #516,#128,#78,#24,rec ;bev 11
  53.  TLreqbev #520,#130,#70,#20
  54.  moveq #3,d0               ;print instructions (string 3-10)
  55.  moveq #8,d2
  56.  moveq #8,d3
  57.  
  58. Pr_info:
  59.  TLstring d0,#16,d2
  60.  addq.w #1,d0
  61.  addq.w #8,d2
  62.  dbra d3,Pr_info
  63.  move.l xxp_AcWind(a4),a5
  64.  move.l xxp_Window(a5),a0
  65.  move.w xxp_LeftEdge(a0),d0 ;set d0-d3 to limits of printable area
  66.  move.w xxp_TopEdge(a0),d1
  67.  move.w xxp_PWidth(a0),d2
  68.  sub.w d0,d2
  69.  subq.w #1,d2
  70.  move.w xxp_PHeight(a0),d3
  71.  sub.w d1,d3
  72.  subq.w #1,d3
  73.  
  74.  TLgetarea d0,d1,d2,d3,a4  ;select in printable area
  75.  beq.s Pr_canc             ;go if cancelled
  76.  
  77.  move.l xxp_gfxb(a4),a6    ;set window draw mode to complement
  78.  move.l xxp_WPort(a5),a1
  79.  moveq #RP_COMPLEMENT,d0
  80.  jsr _LVOSetDrMd(a6)
  81.  
  82.  move.l (a4),d0            ;complement area selected
  83.  move.l 4(a4),d1
  84.  move.l 8(a4),d2
  85.  sub.l d0,d2
  86.  addq.l #1,d2
  87.  move.l 12(a4),d3
  88.  sub.l d1,d3
  89.  addq.l #1,d3
  90.  subq.w #4,d0              ;make rel to printable area
  91.  sub.w #11,d1
  92.  TLreqarea d0,d1,d2,d3
  93.  TLreqinfo #13             ;highlighted: wait for acknowledge
  94.  rts
  95.  
  96. Pr_canc:
  97.  TLreqinfo #12             ;cancel: wait for acknowledge
  98.  rts
  99.